﻿<%@ Page Language="C#" AutoEventWireup="true" Inherits="HMS.PL.Forms.CreateNodeType"
    CodeBehind="~/Forms/CreateNodeType.aspx.cs" %>

<% Response.AddHeader("Pragma", "no-cache"); %>
<% Response.AddHeader("Cache-Control", "no-cache"); %>
<% Response.AddHeader("Cache-Control", "no-store"); %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <link type="text/css" rel="stylesheet" href="../Style/!style1.css" />
    <link type="text/css" rel="stylesheet" href="../Style/common.css" />
    <title>Create Node Type</title>
    <script type="text/javascript" src="../Scripts/Tree.js"></script>
    <script type="text/javascript" src="../Scripts/jquery-1.6.1.js"></script>
    
    <script type="text/javascript">
        $(document).ready(function () {
            ////debugger;
            var id = $("#hid_NodeId").val();
            var type_id = $("#hid_NodeTypeId").val();
            var hier_id = $("#hid_HierarchyId").val();
            var table_name = $("#hid_TableName").val();
            var vers_id = $("#hid_VersionId").val();
        });


        function Submit() {

            //debugger;
            if (!$.trim($("#txt_NodeTypeName").val())) {
                alert("Please enter the node name !");
                return false;
            }

            var fname = $('#fileupload').val();

            if (fname != "" && fname != "undefined" && fname != null) {

                var arr = fname.split("\\");
                fname = arr[arr.length - 1];

                var fileExtension = fname.substr((fname.lastIndexOf('.') + 1));

                if (fileExtension == "bmp" || fileExtension == "png" || fileExtension == "jpg" || fileExtension == "jpeg" || fileExtension == "gif" || fileExtension == "tif") {
                    document.forms["formCreateNodeType"].submit();
                    return true;
                }
                else {
                    alert("Please Select Image file for upload !");
                    return false;
                }
            }
            else {

                document.forms["formCreateNodeType"].submit();
                return true;
            }
        }

        function Close(ident, fname, nodename, IsOwnParent) {
            // alert(nodename);
            window.returnValue = "{ NodeName: '" + nodename + "',IsOwnParent: '" + IsOwnParent + "',ident: '" + ident + "',image: '" + fname + "'}";
            window.close();
        }

        function CloseDup() {
            //debugger;
            //alert("");
            window.returnValue = "duplicate";
            window.close();
        }

    </script>
</head>
<body>
    <form id="formCreateNodeType" runat="server">
    <div align="center">
        <table>
            <tr>
                <td style="padding-top: 20px; text-align: left;">
                    Enter the Name of the Node Type
                </td>
            </tr>
            <tr>
                <td>
                    <input type="text" id="txt_NodeTypeName" class="popupInput" runat="server" />
                </td>
            </tr>
            <tr>
                <td>
                    <%--<iframe src="Import.aspx" style="border: 0px; height: 30px; width: 100%" id="frameFile"
                        bordercolor="white" frameborder="0"></iframe>--%>
                    <span>Select the Image of Node Type</span>&nbsp;
                </td>
            </tr>
            <tr>
                <td>
                    <asp:FileUpload ID="fileupload" runat="server" accept="image/*" />
                    <%--<input type="file" name="fileupload1" id="fileupload1" accept="image/*" runat="server"/>--%>
                    <input id="SubmitRel" type="button" value="Submit" class="submit-button" style="height: 24px;
                        display: none;" />
                </td>
            </tr>
            <tr>
                <td>
                    <input type="checkbox" class="rptInput" value="" name="chkOwnParent" id="chkOwnParent"
                        runat="server">
                    <span>Can be it's own parent</span>
                </td>
            </tr>
            <%--  <tr>
                <td style="text-align: left;">
                    Select the Type of the node
                </td>
            </tr>
            <tr>
                <td>
                    <select size="5" id="drp_NodeType" class="popupSelect">
                    </select>
                </td>
            </tr>--%>
            <tr>
                <td align="center">
                    <input id="submitNode" type="button" value="Submit" onclick="javascript:Submit();"
                        class="popupButton" />
                    <input type="button" value="Cancel" onclick="javascript:self.close();" class="popupButton" />
                    <asp:HiddenField ID="hid_NodeId" runat="server" />
                    <asp:HiddenField ID="hid_NodeTypeId" runat="server" />
                    <asp:HiddenField ID="hid_TableName" runat="server" />
                    <asp:HiddenField ID="hid_HierarchyId" runat="server" />
                    <asp:HiddenField ID="hid_VersionId" runat="server" />
                    <asp:HiddenField ID="hid_txtdate" runat="server" />
                </td>
            </tr>
        </table>
    </div>
    </form>
</body>
</html>
